<html>
<head>
<title>MaxMinAvgFinder.java</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
.ln { color: rgb(0,0,0); font-weight: normal; font-style: normal; }
.s0 { color: rgb(0,0,128); font-weight: bold; }
.s1 { }
.s2 { color: rgb(128,128,128); font-style: italic; }
.s3 { color: rgb(0,0,255); }
</style>
</head>
<BODY BGCOLOR="#ffffff">
<TABLE CELLSPACING=0 CELLPADDING=5 COLS=1 WIDTH="100%" BGCOLOR="#C0C0C0" >
<TR><TD><CENTER>
<FONT FACE="Arial, Helvetica" COLOR="#000000">
MaxMinAvgFinder.java</FONT>
</center></TD></TR></TABLE>
<pre>

<a name="l1"><span class="s0">package </span><span class="s1">zadanie1; 
<a name="l2"> 
<a name="l3"></span><span class="s2">/** 
<a name="l4"> * Author: Daniel Michalski 
<a name="l5"> * Date: 28.02.13 
<a name="l6"> */</span><span class="s1"> 
<a name="l7"> 
<a name="l8"> 
<a name="l9"></span><span class="s0">public class </span><span class="s1">MaxMinAvgFinder { 
<a name="l10">    </span><span class="s0">private double</span><span class="s1">[] tab; 
<a name="l11"> 
<a name="l12">    </span><span class="s0">public </span><span class="s1">MaxMinAvgFinder(</span><span class="s0">double</span><span class="s1">[] tab) { 
<a name="l13">        </span><span class="s0">this</span><span class="s1">.tab = tab; 
<a name="l14">    } 
<a name="l15"> 
<a name="l16">    </span><span class="s0">public double </span><span class="s1">min() { 
<a name="l17">        </span><span class="s0">double </span><span class="s1">min = </span><span class="s3">0</span><span class="s1">; 
<a name="l18">        </span><span class="s0">for </span><span class="s1">(</span><span class="s0">int </span><span class="s1">i = </span><span class="s3">0</span><span class="s1">; i &lt; tab.length; i++) { 
<a name="l19">            </span><span class="s0">if </span><span class="s1">(i == </span><span class="s3">0</span><span class="s1">) 
<a name="l20">                min = tab[i]; 
<a name="l21"> 
<a name="l22">            </span><span class="s0">if </span><span class="s1">(tab[i] &lt; min) 
<a name="l23">                min = tab[i]; 
<a name="l24">        } 
<a name="l25">        </span><span class="s0">return </span><span class="s1">min; 
<a name="l26">    } 
<a name="l27"> 
<a name="l28">    </span><span class="s0">public double </span><span class="s1">max() { 
<a name="l29">        </span><span class="s0">double </span><span class="s1">max = </span><span class="s3">0</span><span class="s1">; 
<a name="l30">        </span><span class="s0">for </span><span class="s1">(</span><span class="s0">int </span><span class="s1">i = </span><span class="s3">0</span><span class="s1">; i &lt; tab.length; i++) { 
<a name="l31">            </span><span class="s0">if </span><span class="s1">(i == </span><span class="s3">0</span><span class="s1">) 
<a name="l32">                max = tab[i]; 
<a name="l33"> 
<a name="l34">            </span><span class="s0">if </span><span class="s1">(tab[i] &gt; max) 
<a name="l35">                max = tab[i]; 
<a name="l36">        } 
<a name="l37">        </span><span class="s0">return </span><span class="s1">max; 
<a name="l38">    } 
<a name="l39"> 
<a name="l40">    </span><span class="s0">public double </span><span class="s1">avg() { 
<a name="l41">        </span><span class="s0">double </span><span class="s1">suma = </span><span class="s3">0</span><span class="s1">; 
<a name="l42"> 
<a name="l43">        </span><span class="s0">for </span><span class="s1">(</span><span class="s0">int </span><span class="s1">i = </span><span class="s3">0</span><span class="s1">; i &lt; tab.length; i++) { 
<a name="l44">            suma += tab[i];    </span><span class="s2">// suma=tab[i]+suma;</span><span class="s1"> 
<a name="l45">        } 
<a name="l46"> 
<a name="l47">        </span><span class="s0">return </span><span class="s1">suma / tab.length; 
<a name="l48">    } 
<a name="l49">} 
<a name="l50"> 
<a name="l51"></span></pre>
</body>
</html>